# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=py3-elftools
_pkgname=py${pkgname##py3-}
pkgver=0.30
pkgrel=1
pkgdesc="Parsing ELF and DWARF in Python"
url="https://github.com/eliben/pyelftools"
arch="noarch"
license="Unlicense"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
subpackages="$pkgname-pyc $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/eliben/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 test/run_all_unittests.py
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -m644 README.rst CHANGES \
		"$pkgdir"/usr/share/doc/$pkgname/doc
}

sha512sums="
5bd4c797f90307e351d541b8de8f76124c66e497b68b811f7012e1271c902beb6ab530a424b338777d12277d44f9b5f89f049e05d9fc2ec36a90b6fa16f1c1a4  py3-elftools-0.30.tar.gz
"
